<%@ CODEPAGE=65001 %>
<%
'///////////////////////////////////////////////////////////////////////////////
'// 插件应用:    Z-Blog 1.8 spirit 其它版本未知
'// 插件制作:    狼的旋律(http://www.wilf.cn)
'// 备    注:    WindsPhoto Sitemap
'// 最后修改:
'// 最后版本:
'///////////////////////////////////////////////////////////////////////////////
%>
<% 'Option Explicit %>
<% 'On Error Resume Next %>
<% Response.Charset="UTF-8" %>
<% Response.Buffer=True %>
<!-- #include file="../../c_option.asp" -->
<!-- #include file="../../../zb_system/function/c_function.asp" -->
<!-- #include file="../../../zb_system/function/c_system_lib.asp" -->
<!-- #include file="../../../zb_system/function/c_system_base.asp" -->
<!-- #include file="../../../zb_system/function/c_system_plugin.asp" -->
<!-- #include file="../p_config.asp" -->
<%
Call System_Initialize()
Call WindsPhoto_Initialize()

If CheckpluginState("windsphoto") = False Then Call ShowError(48)

Dim sXmlClear, sXmlHead, sXmlEnd

sXmlClear = "<?xml version=""1.0"" encoding=""UTF-8""?>"& VBCRLF
sXmlHead = "<urlset xmlns=""http://www.google.com/schemas/sitemap/0.84"">"& VBCRLF
sXmlEnd = "</urlset>"

Response.Contenttype = "text/xml"

Response.Write sXmlClear
Response.Write sXmlHead

response.Write "<url>"& VBCRLF
response.Write "<loc>"&WP_SUB_DOMAIN&"</loc>"& VBCRLF
response.write "<lastmod>" & ParseDateForISO8601(now()) & "</lastmod>"& VBCRLF
response.Write "<changefreq>always</changefreq>"& VBCRLF
response.Write "<priority>0.9</priority>"& VBCRLF
response.Write "</url>"& VBCRLF

Dim rs2,sql2,nopass
sql2 = "select * from windsphoto_zhuanti where pass<>''"
nopass = 0
Set rs2 = server.CreateObject("adodb.recordset")
rs2.Open sql2, objconn, 1, 1
Do While Not rs2.EOF
	nopass = nopass &","& rs2("id")
	rs2.movenext
Loop
rs2.Close
Set rs2 = Nothing

Dim rs,sql,itime
sql = "select * from windsphoto_desktop where zhuanti not in ("&nopass&") order by id desc"
Set rs = server.CreateObject("adodb.recordset")
rs.Open sql, objconn, 1, 1
itime=rs("itime")
If itime="" Then itime=now()
Do While Not rs.EOF
    response.Write "<url>"& VBCRLF
    response.Write "<loc>"&WP_SUB_DOMAIN&"display.asp?id="&rs("id")&"</loc>"& VBCRLF
    response.write "<lastmod>" & ParseDateForISO8601(itime) & "</lastmod>"& VBCRLF
    response.Write "<changefreq>weekly</changefreq>"& VBCRLF
    response.Write "<priority>0.5</priority>"& VBCRLF
    response.Write "</url>"& VBCRLF
    rs.movenext
Loop
rs.Close
Set rs = Nothing

Response.Write sXmlEnd

Function ParseDateForISO8601(dtmDate)

    Dim dtmDay, dtmWeekDay, dtmMonth, dtmYear
    Dim dtmHours, dtmMinutes, dtmSeconds

    Dim strTimeZone
    TimeZone=ZC_TIME_ZONE

    dtmYear = Year(dtmDate)
    dtmMonth = Right("00" & Month(dtmDate),2)
    dtmDay = Right("00" & Day(dtmDate),2)

    dtmHours = Right("00" & Hour(dtmDate),2)
    dtmMinutes = Right("00" & Minute(dtmDate),2)
    dtmSeconds = Right("00" & Second(dtmDate),2)

    strTimeZone=Left(TimeZone,3) & ":" & Right(TimeZone,2)

    ParseDateForISO8601 = dtmYear & "-" & dtmMonth & "-" & dtmDay & "T" & dtmHours & ":" & dtmMinutes & ":" & dtmSeconds & strTimeZone

End Function

Call System_Terminate()
%>